<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="formId">
				<div class="select-list">
					<ul>
						<li>
							外部单号：<input type="text" name="outOrderId"/>
						</li>
						<li>
							内部单号：<input type="text" name="orderNo"/>
						</li>
						<li>
							承兑商号：<input type="text" name="acceptName"/>
						</li>
						<li>
							代理账号：<input type="text" name="agentName"/>
						</li>
						<li>
							订单状态：<select name="inState" th:with="type=${@dict.getType('pay_order_in_state')}">
							<option value="">所有</option>
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
						</li>
						<li class="select-time">
							<label>下单时间： </label>
							<input type="text" class="date-time-input" id="startCreateTime" placeholder="开始" name="params[beginCreateTime]"/>
							<span>-</span>
							<input type="text" class="date-time-input" id="endCreateTime" placeholder="结束" name="params[endCreateTime]"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.detail()" shiro:hasPermission="aerchant_order_detail">
				<i class="fa fa-edit"></i> 详情
			</a>
			<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="aerchant_order_export">
				<i class="fa fa-download"></i> 导出
			</a>
		</div>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
		
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var logicType = "order_in_bohui";
    var conformShouKuanFlag = [[${@permission.hasPermi('aerchant_order_edit')}]];
    var prefix = ctx + "aerchant/order";
    var modelName = "orderin";
    var payTypeDir = [[${@dict.getType('pay_type')}]];
    var orderInStateDir = [[${@dict.getType('pay_order_in_state')}]];
    var tokenUnit = [[${tokenUnit}]];
    var fabiUnit = [[${fabiUnit}]];
    $(function() {
        var options = {
            url: prefix + "/list/"+logicType,
            detailUrl: prefix + "/"+modelName+"/"+logicType+"/{id}",
            exportUrl: prefix + "/export/"+logicType,
            startYiYiUrl: ctx + "aerchant/logic/startYiYi",
            closeYiYiUrl: ctx + "aerchant/logic/closeYiYi",
            startZhongCaiUrl: ctx + "aerchant/logic/startZhongCai",

            modalName: "入金订单",
            search: false,
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field : 'id',
                    title : '编号',
                    visible: true
                },
                {
                    field : 'outOrderId',
                    title : '外部单号',
                    sortable: false
                },
                {
                    field : 'orderNo',
                    title : '内部单号',
                    sortable: false
                },
                {
                    field : 'payType',
                    title : '入金方式',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(payTypeDir, value);
                    }
                },
                {
                    field : 'usdtNo',
                    title : '充值数量(TOKEN)',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return value + tokenUnit;
                    }
                },
                {
                    field : 'currencyNum',
                    title : '充值金额(法币)',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return value + fabiUnit;
                    }
                },
                {
                    field : 'client',
                    title : '付款信息',
                    sortable: true
                },
                {
                    field : 'aerchantNum',
                    title : '商户入金(TOKEN)',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return value + tokenUnit;
                    }
                },
				{
					field : 'plantFeeRate',
					title : '平台手续费率',
                    formatter: function(value, row, index) {
                        return (value * 100) + '%';
                    }
				},
                {
                    field : 'plantFee',
                    title : '平台手续费金额(TOKEN)',
                    sortable: false,
                    formatter: function(value, row, index) {
                        return value + tokenUnit;
                    }
                },
                {
                    field : 'agentFee',
                    title : '代理抽成金额(TOKEN)',
                    sortable: false,
                    formatter: function(value, row, index) {
                        return value + tokenUnit;
                    }
                },
                {
                    field : 'aerchantFee',
                    title : '商户收益(TOKEN)',
                    sortable: false,
                    formatter: function(value, row, index) {
                        return value + tokenUnit;
                    }
                },
                {
                    field : 'inState',
                    title : '订单状态',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderInStateDir, value);
                    }
                },
                {
                    field : 'objectionName',
                    title : '提出异议用户',
                    sortable: false
                },
                {
                    field : 'objectionCreateTime',
                    title : '提出异议时间',
                    sortable: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var actions = [];

                        //NEW("1", "未支付"),PAYED("2", "用户确认支付")
                        if(row.inState == '1' || row.inState == '2') {
                            actions.push('<a class="btn btn-warning btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.startYiYi(\'' + row.id + '\')"><i class="fa fa-warning"></i>提出异议</a> ');
                        }
                        //YIYI_SH("4", "商户提出异议"),
                        if(row.inState == '4') {
                            actions.push('<a class="btn btn-info btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.startChart(\'' + row.id + '\')"><i class="fa fa-weixin"></i>联系承兑商</a> ');
                            actions.push('<a class="btn btn-success btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.closeYiYi(\'' + row.id + '\')"><i class="fa fa-check"></i>关闭异议</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.startZhongCai(\'' + row.id + '\')"><i class="fa fa-upload"></i>提出仲裁</a> ');
                        }
                        //YIYI_CDS("A", "承兑商提出异议"),
                        if(row.inState == 'A') {
                            actions.push('<a class="btn btn-info btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.startChart(\'' + row.id + '\')"><i class="fa fa-weixin"></i>联系承兑商</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.startZhongCai(\'' + row.id + '\')"><i class="fa fa-upload"></i>提出仲裁</a> ');
                        }
                        //TIMEOUT("6", "超时未支付")
                        if(row.inState == '6') {
                            actions.push('<a class="btn btn-warning btn-xs ' + conformShouKuanFlag + '" href="#" onclick="$.operate.startYiYi(\'' + row.id + '\')"><i class="fa fa-warning"></i>提出异议</a> ');
                        }
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>